class Solution:
    def maximumGap(self, nums: list) -> int:
        if len(nums) < 2:
            return 0
        nums.sort()
        res = 0
        try:
            for i in range(len(nums)):
                res = max(res, nums[i+1] - nums[i])
        except:
            return res


a = Solution()
print(a.maximumGap([3, 6, 9, 1]))
print(a.maximumGap([10]))